package com.cq.ssm.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cq.ssm.mapper.UserMapper;
import com.cq.ssm.po.User;
import com.cq.ssm.service.UserService;

@Component("userService")
public class UserServiceImpl implements UserService{

	@Autowired
	private UserMapper userMapper;

	public User getUserByUserName(String username)  throws Exception{
		return userMapper.selectByPrimaryKey(username);
	}

	public boolean updatePassword(String username, String password)
			throws Exception {
		User u = new User();
		u.setUsername(username);
		u.setPassword(password);
		u.setType(null);
		int i = userMapper.updateByPrimaryKeySelective(u);
		return i==1?true:false;
	}
}
